/*
 * [Ronny Abraham]
 * [ronnya@gmail.com]
 * CS530:DUI, Assignment [#1]
 */


public class PreviewView
{
	PreviewView(PreviewController controller, Actor actor)
	{
		itsPreviewController = controller;
		ActorGeometry defaultGeometry = new ActorGeometry();
		itsPreviewPanel = new PreviewPanel(defaultGeometry);
		if(actor != null)
		{
			setGeometry(defaultGeometry, actor);
			itsPreviewPanel.itsShirtColor = ClothesColor.getColorVal(actor.shirtColor);
			itsPreviewPanel.itsPantsColor = ClothesColor.getColorVal(actor.pantsColor);
		}
	}
	
	public void update()
	{
		itsPreviewPanel.repaint();
	}

	public void setArcVisible(boolean draw)
	{
		itsPreviewPanel.drawArc = draw;
	}
	
	private void setGeometry(ActorGeometry geometry, Actor actor)
	{
		float factorX = (float)actor.width / Actor.defaultWidth;
		float factorY = (float)actor.height / Actor.defaultHeight;
		itsPreviewController.scaleAroundCenter(geometry, factorX, factorY);
	}

	private PreviewController itsPreviewController;
	public PreviewPanel itsPreviewPanel;
}
